
package supply;

import java.io.*;
import java.io.InputStreamReader;

public class Main {

   //The Variable Mainmenu is used to store the User Menu Input
   private static int Mainmenu;

   // Declaration and Initialization of the instance object to call the functions from other class
   static product pro=new product();
   static inventory inv=new inventory();

   public static void main(String[] args) throws IOException {

    // The Reader's are declared to get the User input for Menu selection
   InputStreamReader is1=new InputStreamReader(System.in);
   BufferedReader br1=new BufferedReader(is1);

   

   System.out.println("Welcome to the Inventory System :");
   System.out.println("___________________________________________________");
   System.out.println("The Product that the Manufacturer could produce are : ");
   System.out.println("0 -> Veg Rice");
   System.out.println("1 -> Veg Noodles");
   System.out.println("2 -> Egg Rice");
   System.out.println("3 -> Egg Noodles");
   System.out.println("4 -> Chicken Rice");
   System.out.println("5 -> Mixed Rice Noodles");
   System.out.println("---------------------------------------------------------------");
   System.out.println("All the Above Products should be added in the inventory System");
   System.out.println("---------------------------------------------------------------");
   System.out.println("---------------------------------------");
   System.out.println("0 -> Add the Products to the Inventory System");
   
   

   Mainmenu=Integer.parseInt(br1.readLine());

   if(Mainmenu==0)
   {
       pro.addProduct();
   }
   else
   {
       System.out.println("The Product that the Manufacturer could produce should be added to the inventory First");
       pro.addProduct();
   }
  

 }

   // The Method that displays the Menu and gets the Input from the User
    public static void starting() throws IOException
    {
    while(Mainmenu != -1)
    {
    InputStreamReader is2=new InputStreamReader(System.in);
    BufferedReader br2=new BufferedReader(is2);
    System.out.println();
    System.out.println("---------------------------------------");
    System.out.println("Select the number from the Menu Below :");
    System.out.println("---------------------------------------");
    System.out.println("1 -> Select the Product");
    System.out.println("2 -> Check the Inventory");
    System.out.println("3 -> Display the Products that can be Produced");
    System.out.println("4 -> Write the inventory Items to file");
    System.out.println("Enter -1 to Quit the Program");
    System.out.print("Prompt >");
    Mainmenu=Integer.parseInt(br2.readLine());

    if(Mainmenu==1)
   {
        pro.selectProduct();
   }
  else if (Mainmenu==2)
   {
        inv.availableitems();
   }

    else if (Mainmenu==3)
   {
        pro.displayProducts();
   }

    else if (Mainmenu==4)
   {
        inv.availableitems1();
   }
  else
  {
      System.out.println("Please Enter the Number From the Menu or Enter -1 to Quit the Program");

  }
    }
    System.out.println();
    System.out.println("<----------Thank You for Using the Inventory System--------->");
    System.out.println("<----------Name : Rajasekhar   Student ID : 12400404--------->");
    
  }
     

}
